home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-04-26 | 22.5 KB | 743 lines | [TEXT/MACA] |
- terse
- ;*******************************************************
- ; ZoomWindow ( WDEF0 from System 3.2 )
- ; Commented by
- ; Chris Gehlker
- ; Grand Canyon Code Factory
- ; 3158 W. Woodridge Dr.
- ; Phoenix, AZ 85023
- ; (602) 688-9024
- ;*******************************************************
- ; This code is no doubt © by Apple Computer
- ; I jobbed comments from Andy Hertzfeld's 1982
- ; version whenever they were appropriate.
- ; WDEF0 was disassembled with TMON
- ;*******************************************************
- ; McAssembly V6.2
- ;*******************************************************
- ftype '????'
- if1
- ipath "Assembler:.PSM files:"
- Incl "SysEqu.psm" system equates
- incl "QuickEqu.PSM" quick draw equates
- incl "ToolEqu.PSM" toolbox equates
- incl "All Traps.PSM" register-based trap words
- endi
- ;-------------------------------------------------------
- tcomp
- ;-------------------------------------------------------
- True equ $FFFF
- False equ 0
- FontInfo equ -8
- RgnHandle equ -12
- TextHeight requ D7
- BoxOffSet equ -2
- base A6,FontInfo,RgnHandle,BoxOffSet
- base A3,wZoom,wdataHandle,portRect,wVisible,wHilited,StructRgn
- base A3,wGoAway,portBounds,ContRgn,wTitleWidth
- _Debugger trapw $A9FF
- [[ WDEF,3,$20,TileProc
- start LINK A6,#-12 set up stack frame
- MOVEM.L D3-D7/A1-A4,-(SP) save registers
- MOVE.L (A5),A0 pointer to current port
- MOVE.L (A0),-(SP) save it on the sack
- MOVE.L WMgrPort,(A0) set current port to whole screen
- LEA FontInfo,A3
- GetFontInfo A3
- MOVE (A3)+,TextHeight ascent
- ADD (A3)+,TextHeight descent
- ADDQ #4,TextHeight D7 is ascent+descent+4
- BSET #0,TextHeight round up to odd
- MOVE.L #19,D1
- CMP D1,TextHeight D7 >= 19?
- BGE.S BigType
- SUB TextHeight,D1
- LSR #1,D1 halve D1
- ADD D1,FontInfo add D1 to ascent
- MOVE.L #19,TextHeight D7 = 19 again
- BigType
- ; here D7 = Max( ascent+descent+4 rounded, 19)
- MOVE TextHeight,(A3)+ put D7 in -4(A6)
- MOVE TextHeight,D0
- SUBI #13,D0 adjust size
- LSR #1,D0 halve D0
- MOVE D0,(A3) put D0 in BoxOffSet
- NewRgn =RgnHandle
- LEA 8(A6),A0 get pointer to 1st parameter
- MOVE.L (A0)+,D3 parameter in D3
- MOVE (A0)+,D0 message in D0
- MOVE.L (A0)+,A3 get window pointer
- MOVE (A0)+,D5 variation code
- MOVE D5,D6 keep a copy
- ANDI #3,D5 just DocProc - AltDProc
- CLR.L (A0) clear function result
- ;-------------------------------------------------------
- ; case out on message
- ;-------------------------------------------------------
- ADD D0,D0 double D0
- LEA MessageJmp,A0 get jump address
- ADD MessageJmp(D0),A0 compute dispatch
- JSR (A0) go for it
- ;-------------------------------------------------------
- ; standard code for returning to caller
- ;-------------------------------------------------------
- DisposRgn RgnHandle clean up
- _SetPort it was saved on the stack
- MOVEM.L (SP)+,D3-D7/A1-A4 restore registers
- UNLK A6
- MOVE.L (SP)+,A0 get return address
- ADD #12,SP clear parameters
- JMP (A0)
- ;-------------------------------------------------------
- MessageJmp ; the message jump table
- dw Draw-MessageJmp
- dw Hit-MessageJmp
- dw Calc-MessageJmp
- dw Init-MessageJmp
- dw Dispose-MessageJmp
- dw Grow-MessageJmp
- dw GrowIcon-MessageJmp
- ;-------------------------------------------------------
- Init LOC
- BTST #3,D6 zoomwindow?
- BEQ.S .1 nope
- CLR.B wZoom clear spareflag
- TST ROM85 Hey Mac, how old are you?
- BMI.S .1 can't teach an old dog new tricks
- MOVE.L #16,D0 size of space
- _NewHandle,CLEAR 16 byte scratch area
- BNE.S .1 bail out on error
- ADD.B #1,wZoom it's done
- MOVE.L A0,wdataHandle set handle to scratch record
- MOVE.L (A0),A4 pointer in A4
-
- ; first do the standard state
-
- ADD #8,A4 point to standard state
- MOVE.L GrafGlobals(A5),A1 pointer to port
- MOVE.L screenBits+bounds(A1),(A4)+ load Screenbits.Bounds.topLeft
- MOVE.L screenBits+bounds+botRight(A1),(A4)+ and botRight
- MOVEQ #3,D0 set up for inset
- SUB D0,-(A4) inset all around
- SUB D0,-(A4)
- ADD D0,-(A4)
- ADD D0,-(A4)
- ADD TextHeight,(A4) adjust for title
- ADD TextHeight,(A4) twice the font height
- ;
- ; now do user state
- ;
- MOVE.L (A0),A4 point to user state
- ;-------------------------------------------------------
- ; On return A4 points to the portRect of the current state
- ; in global coordinates.
- ;-------------------------------------------------------
- GlobalPortRect
- MOVE.L A4,-(SP) push scratch area
- MOVE.L portRect+topLeft(A3),(A4) put top left of the portRect in scratch area
- MOVE.L portRect+botRight(A3),4(A4) now bottom right
- MOVE.L portBounds(A3),-(SP) push screen coordinates
- NEG (SP)
- NEG 2(SP)
- _OffsetRect convert to global coordinates
- .1 RTS
- GetState
- LOC
- SUB #8,SP put space on stack
- MOVE.L SP,A4 get a pointer to it
- BSR.S GlobalPortRect get the portRect in global coordinates
- MOVE.L wDataHandle,A0 get handle to the zoom record
- MOVE.L (A0),A2 pointer to the zoom record
- ADD #8,A2 point to standard state
- BSR.S .3 test the topleft corner
- BNE.S .2 must be user state
- BSR.S .3 test bottom right corner
- BEQ.S .1 it was standard state
- .2 MOVE.L wDataHandle,A0 get handle to zoom record
- MOVE.L (A0),A4 dereference it into A4
- BSR.S GlobalPortRect get the portRect in global coordinates
- MOVEQ #1,D0 signal user state
- .1 ADD #8,SP remove structure from stack
- RTS
- .3 ; test if a point is within 7 pixels of another in each direction
- MOVE.L (A2),-(SP) push the point
- MOVE.L (A2)+,-(SP) make another copy
- MOVE.L SP,-(SP) point at the one point rectangle
- MOVE.L #$FFF9FFF9,-(SP) push (-7,-7)
- _InsetRect a trick to make a 14 X 14 rect centered on the point
- CLR -(SP) for result
- MOVE.L (A4)+,-(SP) push the point
- PEA 6(SP) point to the 14 X 14 rect
- _PtInRect
- SUB.B #1,(SP)
- MOVE.B (SP)+,D0
- ADD #8,SP throw away the stack rect
- RTS
- line
- ZoomTest
- LOC
- BTST #3,D6 is it Zoom?
- BEQ .1 if not just return
- TST.B wZoom test for zoom
- .1 RTS
- Dispose BSR.S ZoomTest
- BEQ.S .2
- MOVE.L wDataHandle,A0
- _DisposHandle if we used a zoom structure, clean it up.
- .2 RTS
- line
- Draw LOC
- TST.B wVisible is it visible?
- BEQ DrawDone if not, do nothing
- CMPI #wInGoAway,D3 is it a GoAway or zoom click?
- BGE ZoomOrGoAway if so, handle it
- ;
- ; draw the window frame with title bar if appropriate
- ;
- PenNormal use standard pen
- TST D5 test dialog box flag
- BNE DrawDBox dialog box has no title
- BSR BuildTBarRect go build the title bar
- PEA TempRect TempRect bounds the title bar
- MOVE.L (SP),-(SP) push another copy
- MOVE.L (SP),-(SP) and yet another
- _FrameRect frame the title bar
- MOVE.L OneOne,-(SP) push inset factor
- _InsetRect inset it
- _EraseRect clear inside
- BSR DoTitleString
- TST.B wHilited is it hilited
- BEQ DrawWindow if not, then just draw it
- InsetRect !TempRect,#1,BoxOffSet inset the title box
- MOVE TempRect+right,-(SP) push right
- MOVE D3,TempRect+right put title right in TempRect
- MOVE.L TempRect,D0 get topleft
- ANDI.L #$00070007,D0 only use mod 8
- MOVE.L GrafGlobals(A5),A4 get graf globals
- MOVE.L D0,-168(A4) nasty nasty messing with QD's privates!
- FillRect !TempRect,!HilitePattern
- BSR.S ZoomTest is it a zoom window?
- BEQ.S .1 skip if not
- MOVE (SP),D0 D0 = TempRect right
- SUBI #26,D0 move left 26 pixels
- CMP D4,D0 compare to text right
- BGE.S .1 skip if text fits
- MOVE D0,D4 clip if it doesn't
- .1 MOVE (SP)+,TempRect+right restore right edge from stack
- MOVE D4,TempRect+left set left edge 26 pixels from right
- FillRect !TempRect,!HilitePattern
- CLR.L -168(A4) Do it again
- TST.B wGoAway
- BEQ.S .2 skip if not GoAway
- BSR BuildTBarRect build it again based on new TempRect
- LEA GoAwayData,A1 get pointer to GoAwayData
- MOVE.L #0,D0 clear out D0
- BSR LeftBox draw the box on the left side
- .2 BSR.S ZoomTest is this a zoom window?
- BEQ.S DrawWindow if not, just draw it
- BSR BuildTBarRect build the tille bar in TempRect
- LEA ZoomData,A1 get zoom box data
- MOVEQ #0,D0
- BSR RightBox draw the box on the right side
- DrawWindow
- LOC
- MOVE.L OneOne,D4 load the shadow factor
- DrawFrame
- MOVE.L StructRgn,A0 get handle to StructRgn
- MOVE.L (A0),A0 dereference it
- LEA rgnBBox(A0),A4 point A4 at bounding box of StructRgn
- SUB D4,4(A4) subtract shadow factor from bottom
- SUB D4,6(A4) and from right
- FrameRect A4
- CMPI #3,D5 Is it an AltDbox?
- BEQ.S .3 If so, paint it
- TST D5 Document Box?
- BNE.S .1 If not, it has no drop shadow
- .3 BSR PaintDropShadow
- ;
- ; Draw fancy for dialog box (DBox)
- ;
- .1 CMP #1,D5
- BNE.S .2 If it's a plainDBox, then D0 = 0 and it has no shadow
- MOVE.L (A4),TempRect copy bounds into TempRect
- MOVE.L 4(A4),TempRect+4 bottom right too
- PEA TempRect push the scratch rectangle
- MOVE.L (SP),-(SP) copy it
- MOVE.L (SP),-(SP) copy again
- MOVE.L OneOne,-(SP) inset 1
- _InsetRect
- MOVE.L #$00070007,-(SP)
- _PenSize set pensize
- MOVE.L GrafGlobals(A5),A0 get pointer to QD globals
- PEA White(A0) push white
- _PenPat
- _FrameRect draw the white stripe
- MOVE.L GrafGlobals(A5),A0 get pointer to QD globals
- PEA Black(A0) push black
- _PenPat
- MOVE.L #$00020002,-(SP) push inset factor
- MOVE.L (SP),-(SP) push new pen size
- _PenSize
- _InsetRect
- PEA TempRect push scratch rectangle again
- _FrameRect and draw the black penstripe
- _PenNormal
- .2 ADD D4,Bottom(A4) If we messed with frame for shadowing,
- ADD D4,Right(A4) put it back.
- DrawDone
- RTS
- HilitePattern
- DW $FF00,$FF00,$FF00,$FF00
- ;
- ; build a title bar rectangle in the scratch area TempRect.
- ; D7 holds height of title bar based on font.
- ;
- BuildTBarRect
- LEA TempRect,A0 get pointer to TempRect
- MOVE.L StructRgn,A1 get StructRgn handle
- MOVE.L (A1),A1 get StructRgn pointer
- ADD #RgnBBox,A1 point A1 at bounding box
- MOVE.L (A1)+,(A0) copy bounding box into TempRect
- MOVE.L (A1),4(A0) both vertices
- ;
- ; make bottom := top + TextHeight
- ;
- MOVE Top(A0),D0 get top
- ADD TextHeight,D0 compute top + D7
- MOVE D0,Bottom(A0) update bottom
- SUB #1,Right(A0) inset right
- RTS back to caller
- ZoomOrGoAway
- LOC
- BEQ.S .1 it was in the GoAway box
- BSR.S ZoomTest
- BEQ.S .2 it wasn't a zoom window
- BSR.S BuildTBarRect build the bounding rect
- LEA ZoomMask,A1 get the bitmap
- MOVEQ #srcXor,D0 set XOR as plot mode
- RightBox
- LEA TempRect,A0 point A0 at scratch rectangle
- MOVE Right(A0),Left(A0) shrink box to a line
- MOVEQ #-22,D1 set up to inchworm rectangle
- BRA.S .3
- .1 BSR.S BuildTBarRect build the title bar
- LEA GoAwayMask,A1 load the GoAway mask
- MOVEQ #srcXor,D0 set XOR as plot mode
- LeftBox LEA TempRect,A0 point A0 at scratch rectangle
- MOVEQ #7,D1
- .3 ADD D1,Left(A0) shift left side left by 7 or right by 22
- MOVE BoxOffSet,D1 load BoxOffSet into D1
- ADD D1,(A0) shift bounding rectangle down by adjustment
- SUB #1,(A0) and up by one
- MOVE.L (A0)+,(A0) copy top left to bottom right
- MOVEQ #16,D1 set up for shift
- ADD D1,(A0)+ shift bottom down by 16
- ADD D1,(A0) and right over
- MOVE.L #$00100010,D1 set up boundry rectangle for PlotSymbol
- BSR PlotSymbol
- .2 RTS
- ;
- ; draw a plain dialog box without title bar
- ;
- DrawDBox
- MOVE.L #$00020002,D4 get shadow factor
- CMPI #3,D5 does it have shadow?
- BEQ.S DrawFrame if so, we're cool
- MOVEQ #0,D4 otherwise no shadow
- BRA.S DrawFrame go draw it
-
- ; TempRect holds the title bar
-
- DoTitleString
- LOC
- MOVE TempRect+Right,D4 get right
- MOVE D4,D3 make a copy
- SUB TempRect+Left,D3 compute width
- SUB wTitleWidth,D3 compute extra width
- ASR #1,D3 divide by 2
- MOVEQ #2,D0
- TST.B wGoAway is there a GoAway box
- BEQ.S .1 skip if not
- MOVEQ #32,D0 make sure margin is 32 pixels
- .1 CMP D0,D3 Is extra width eneough to show the box?
- BGE.S .2
- MOVE D0,D3 If not, make it wider.
- .2 ADD TempRect+Left,D3 compute horizontal start of title
- MOVE D4,-(SP) save right coordinate on stack
- BSR.S ZoomTest Does this window have a zoom box?
- BEQ.S .3 skip if not
- SUBI #32,D4 make space for zoom box
- .3 MOVE.L RgnHandle,-(SP) push the region handle from frame
- MOVE.L (SP),-(SP) make a copy
- _GetClip save current clipping region
- MOVE D4,TempRect+Right put adjusted right coordinate in TempRect
- PEA TempRect push TempRect
- _ClipRect set clipping region to TempRect
- MOVE.L GrafGlobals(A5),A0 get pointer to QD globals
- MOVE.L (A0),A0 dereference it
- MOVE.L ClipRgn(A0),-(SP) push the clipping region
- MOVE.L (SP),-(SP) make a copy
- ; Put the intersection of the clipping region and the original clipping
- ; region (from the stack frame) into the clipping region.
- _SectRgn
- MOVE (SP)+,TempRect+Right restore right coordinate to TempRect
- MOVE D3,-(SP) push extra width
- MOVE TempRect+top,D0 put top corner in TempRect
- ADD FontInfo,D0 add ascent
- ADDQ #1,D0 plus one
- MOVE D0,-(SP) push the top coordinate
- _MoveTo move to (top,extra width)
- MOVE.L wTitleHandle(A3),A0 get title handle
- MOVE.L (A0),-(SP) push title pointer
- _DrawString draw it
- MOVE.L Rgnhandle,-(SP) push frame region handle
- _SetClip restore clipping region
- MOVE D3,D0 store the left edge of title in D0
- SUBQ #6,D3 Move it left six pixels
- ADD wTitleWidth,D0 compute right edge of title
- CMP D4,D0 does title hang over?
- BGE.S .4 if not, skip
- MOVE D0,D4 put right edge in D0
- .4 ADDQ #6,D4 add six
- RTS ; return with D4 = right edge of title + six D3 = left - six
- ZoomData
- DW $0000,$0000,$BFFB,$2088 data
- DW $A08B,$2088,$A08B,$2088
- DW $BF8B,$2008,$A00B,$2008
- DW $BFFB,$0000,$0000,$0000
- ZoomMask
- DW $0000,$0000,$0000,$0180 mask
- DW $09A0,$05C0,$0080,$1CF0
- DW $1F80,$0540,$0920,$0100
- DW $0000,$0000,$0000,$0000
- GoAwayData
- DW $0000,$0000,$BFFB,$2008 data
- DW $A00B,$2008,$A00B,$2008
- DW $A00B,$2008,$A00B,$2008
- DW $BFFB,$0000,$0000,$0000
- GoAwayMask
- DW $0000,$0000,$0000,$0100 mask
- DW $0920,$0540,$0000,$1C70
- DW $0000,$0540,$0920,$0100
- DW $0000,$0000,$0000,$0000
-
- Hit
-
- ; On input global mousepoint is in D3 as (v,h)
-
- LOC
- CLR -(SP) make room for function result
- MOVE.L D3,-(SP) push the mouse point
- MOVE.L contRgn,-(SP) push content region handle
- _PtInRgn is the point in the content region
- TST.B (SP)+ well, is it?
- BEQ.S NotInContent if not, go check out drag region
- TST D5 is it a dialog box?
- BNE.S justContent if so, it's only in the content
- BTST #2,D6 is it a noGrow window?
- BGT.S justContent if so, just do content
- TST.B wHilited is it active
- BEQ.S justContent if not, it can't be in grow
-
- ; test for grow box
-
- MOVE.L contRgn,A0 get region handle
- MOVE.L (A0),A0 dereference it
- MOVE.L RgnBBox+botRight(A0),D0 get bottom right of content
- MOVEQ #14,D4 keep in register for speed
- ;
- ; consider horizontal coordinate first
- ;
- SUB D4,D0 offset x by 14 for grow box
- CMP D0,D3 if <, just in content
- BLT.S justContent
- ;
- ; T'aint inside for horizontal so try vertical
- ;
- SWAP D0 put vertical coordinate in low word
- SUB D4,D0 offset y by 14 for grow box
- SWAP D3 put y in low word here too
- CMP D0,D3 is it in the grow box?
- BLT.S justContent if not, it must be in content
- MOVEQ #wInGrow,D0 return InGrow flag
- BRA HitDone
- justContent
- MOVEQ #wInContent,D0 return InContent flag
- BRA HitDone
- ;
- ; It aint in content, see if it's in drag (region)
- ;
- NotInContent
- TST D5 is it a dialog box
- BNE DoneHitComplete dialog box has no drag region
- BSR.S BuildTBarRect build title bar in TempRect and point A0 at it
- CLR -(SP) function result space
- MOVE.L D3,-(SP) push mouse point
- MOVE.L A0,-(SP) push TempRect
- _PtInRect is the point in the rect
- TST.B (SP)+ is it?
- BEQ.S DoneHitComplete If not, it wasn't in window
-
- ; It's somewhere in the title bar. Is it in zoom or goAway box?
-
- TST.B wHilited is it hilited
- BEQ.S ItsInDrag wears masculine clothes if not hilited
- MOVE.L D3,D0 put mouse point in D0
- SWAP D0 move vertical coordinate to low word
- ADD portBounds,D0 convert to relative to top of content region
- SUB portRect,D0 in case content origin not (0,0)
- ADD BoxOffSet,D0 add offset to zoom or goAway box
- BPL.S ItsInDrag mouse click was below box
- ADDI #11,D0 test other side
- BMI.S ItsInDrag click was above box
- TST.B wGoAway does it have a GoAway box?
- BEQ.S .1 if not, see about Zoom box
- MOVE.L D3,D0 put mousepoint back
- ADD portBounds+left(A3),D0 adjust to left of window
- SUB portRect+left(A3),D0 in case origin not (0,0)
- CMP #18,D0 is it too far right?
- BGT.S .1 go test for zoom window
- SUBQ #8,D0 test other side
- BMI.S ItsInDrag it was too far left
- MOVEQ #wInGoAway,D0 bingo!, the GoAway box
- BRA.S HitDone return with answer
- .1 BSR.S ZoomTest see if it's a zoom window
- BEQ.S ItsInDrag if not, point must be in drag
- MOVE D3,D0 put x in D0
- ADD portBounds+left(A3),D0 change left side to global
- SUB portRect+right(A3),D0 adjust to right side
- CMPI #-19,D0 compare to left side of box
- BLT.S ItsInDrag too far left
- CMPI #-9,D0 check out right side
- BGT.S ItsInDrag too far right
- BSR GetState go see if it's zoom in or out
- BEQ.S .2 it was in standard state
- MOVEQ #wInZoomOut,D0 it must have been in user state
- BRA.S HitDone
- .2 MOVEQ #wInZoomIn,D0 it must have been in standard state
- BRA.S HitDone
- ItsInDrag
- MOVEQ #wInDrag,D0 signal drag region
- HitDone MOVE.L D0,20(A6) return result on stack
- DoneHitComplete
- RTS
- Calc LOC
- ;*******************************************************
- ; This code is from the original Apple WDEF0. It is a
- ; high level NOOP
- ; BSR ZoomTest Is it a zoom window?
- ; BEQ.S .1 Only zoom windows have states.
- ; BSR GetState
- ;*******************************************************
- ;
- ;-------------------------------------------------------
- ; First calculate content region.
- ;-------------------------------------------------------
- .1 LEA TempRect,A0 get pointer to working rectangle
- MOVE.L A0,-(SP) push pointer for later offset
- MOVE.L portRect,(A0)+ copy topLeft of portRect
- MOVE.L portRect+botRight,(A0) copy bottom right of portRect
- ;
- ; offset to global coordinates
- ;
- MOVE.L portbounds,-(SP)
- NEG 0(SP) negate offset
- NEG 2(SP) both words
- _OffsetRect offset TempRect to global coordinates
- MOVE.L contRgn,-(SP) content region gets the result
- PEA TempRect
- _RectRgn
- ;
- ; Now do the structure region. First convert the boundry rectangle
- ; (TempRect) to structure isnstead of content.
- ;
- MOVE.L #$00020002,D4 get the shadow factor for DBox
- MOVE.L structRgn,-(SP) push the structure region for later
- PEA TempRect push a pointer to the rect
- MOVE.L (SP),-(SP) make two copies
- MOVE.L MinusOne,-(SP) make one pixel bigger, all around
- _InsetRect make it bigger
- TST D5 is it a DBox?
- BNE.S DoDBoxCalc skip if it is
- MOVE TextHeight,D0
- SUBQ #1,D0
- SUB D0,TempRect+Top make it D7 - 1 pixel higher
- LSR.L #1,D4 adjust shadow factor
- CalcCommon
- _RectRgn RectRgn (structRgn,TempRect)
- ;
- ; add drop shadow if necessary
- ;
- TST D5 is it a document window?
- BEQ.S .2 if so, skip
- CMPI #3,D5 is it an altDBox window?
- BNE.S NoDropShadow
- .2 MOVE.L RgnHandle,-(SP) push the region handle
- PEA TempRect push TempRect
- MOVE.L (SP),-(SP) make another copy
- MOVE.L D4,-(SP) push shadow factor
- _OffsetRect offset it
- _RectRgn
- MOVE.L structRgn,-(SP)
- MOVE.L RgnHandle,-(SP) offset region
- MOVE.L structRgn,-(SP) structRgn gets the result
- _UnionRgn add it in
- NoDropShadow
- RTS
- DoDBoxCalc
- CMPI #1,D5 is it a dBox?
- BNE.S CalcCommon
- PEA TempRect push our rectangle
- MOVE.L #$FFF9FFF9,-(SP) push (-7,-7)
- _InsetRect
- BRA.S CalcCommon
- ;-------------------------------------------------------
- Grow
- ;-------------------------------------------------------
- ; first make it one pixel bigger
- MOVE.L D3,-(SP) push the rect
- MOVE.L MinusOne,-(SP) push (-1,-1)
- _InsetRect
- MOVE.L D3,A3 get rect handle in A3
- MOVE.L (A3),-(SP) push rect pointer
- MOVE TextHeight,D0
- SUBQ #1,D0
- SUB D0,(A3)
- MOVE.L D3,-(SP) push the rectangle
- _FrameRect frame it
- MOVE Left(A3),-(SP) push left
- MOVE bottom(A3),-(SP) push bottom
- SUB #16,(SP) really 16 pixels above bottom
- MOVE.L (SP),-(SP) make a copy of this point
- _MoveTo move to it
- MOVE right(A3),2(SP) now go to the right edge
- _LineTo draw the horizontal line
- ;
- ; draw the upper horizontal line
- ;
- MOVE.L (SP),topLeft(A3)
- MOVE.L (SP),-(SP)
- _MoveTo
- MOVE right(A3),2(SP)
- _LineTo
- ;
- ; draw vertical line
- ;
- MOVE right(A3),-(SP) push right
- SUB #16,(SP) really want right-16
- MOVE top(A3),-(SP)
- MOVE.L (SP),-(SP)
- _MoveTo
- MOVE bottom(A3),(SP)
- _LineTo
- ; return our rect to original
- MOVE.L D3,-(SP) push to inset
- MOVE.L OneOne,-(SP) push (1,1)
- _InsetRect
- RTS
-
- ; Paint a drop shadow around the window. Shadow factor is in D4:
- ; A4 points at bounding box of structure region.
-
- PaintDropShadow
- MOVE.L D4,-(SP) push shadow factor
- _Pensize make pensize = shadow factor
- MOVE right(A4),D0 get right of structure rect
- MOVE D0,-(SP) push right
- MOVE top(A4),-(SP) push top
- ADD D4,(SP) want top + shadow
- MOVE D0,-(SP) push right
- MOVE bottom(A4),D0 get bottom
- MOVE D0,-(SP) push bottom
- MOVE left(A4),-(SP) push left
- ADD D4,(SP) want left + shadow
- MOVE D0,-(SP) push bottom
- _MoveTo MoveTo(left+shadow,bottom)
- _Lineto LineTo(right,bottom)
- _LineTo LineTo(right,top+shadow)
- _PenNormal restore pen
- RTS
- ;
- ; PlotSymbol - plot the little 16 by 16 symbol bitmap pointed to
- ; by A1 into the rectangle held in TempRect. D0 holds mode.
- ;
- PlotSymbol
- LEA IconBitMap,A0 get pointer to source bitmap
- MOVE.L A1,(A0)+ update base address of bitmap
- MOVE #2,(A0)+ update rowBytes
- CLR.L (A0)+ topLeft is (0,0)
- MOVE.L D1,(A0) adjust boundsRect
- ;
- ; push parameters for CopyBits call to transfer arrow bitMap
- ;
- PEA IconBitMap push pointer source bitmap
- MOVE.L (SP),A0 remember in A0, too
- MOVE.L GrafGlobals(A5),A1 get GrafGlobals baseaddress
- MOVE.L thePort(A1),A1 get thePort
- PEA portBits(A1) that's the destination bitmap
- PEA bounds(A0) boundsRect of bitmap is source
- PEA TempRect TempRect is the destination
- MOVE.W D0,-(SP) theMode is in D0
- CLR.L -(SP) no mask region
- ;
- ; transfer the bitMap (stretching as necessary...)
- ;
- _CopyBits let Bill stretch those bits
- RTS bye now
- ; Draw the grow icon. First make this window the current grafPort
- GrowIcon
- MOVE.L A3,-(SP) push it
- _SetPort make that the port
-
- ; compute the grow icon rectangle in tempRect
-
- LEA TempRect,A4 get pointer to tempRect
-
- ; copy in botRight of tempRect
-
- MOVE.L PortRect+botRight(A3),botRight(A4)
- MOVE.L botRight(A4),topLeft(A4) into the topLeft, too
- SUB #15,top(A4) subtract from Top
- SUB #15,left(A4) and left, too
- ;
- ; plot the grow icon
-
- TST.B wHilited is it hilited?
- BEQ.S ClearGoAway if not, go clear it
- LEA GrowBits,A1 get pointer to the bits
- MOVEQ #0,D0 use srcCopy
- MOVE.L #$00100010,D1
- BSR.S PlotSymbol plot it
-
- ; plot the boundry line
- PlotBoundary
- MOVE left(A4),-(SP) push tempRect.left
- MOVE (SP),-(SP) copy it again for later
- MOVE portRect+top(A3),-(SP) push portRect.top
- _MoveTo move to it
- MOVE portRect+bottom(A3),-(SP) push portRect.bottom
- _LineTo draw the vertical line
- ;
- ; now draw the horizontal line
- ;
- MOVE portRect+left(A3),-(SP) push portRect.left
- MOVE top(A4),-(SP) push tempRect.top
- _MoveTo
- MOVE portRect+right(A3),-(SP) push portRect.right
- MOVE top(A4),-(SP) push tempRect.top
- _LineTo
- RTS
- ClearGoAway
- PEA TempRect
- _EraseRect
- BRA.S PlotBoundary
- ;
- ; BitMap for GrowIcon
- ;
- GrowBits
- dw $0000,$0000,$0000,$1FE0
- dw $1020,$103E,$1022,$1022
- dw $1022,$1022,$1FE2,$0402
- dw $0402,$0402,$07FE,$0000
- ]]
- END